perm filename TEST.SAI[X,AIL]1 blob
sn#000859 filedate 1973-08-19 generic text, type T, neo UTF8
COMMENT ⊗ VALID 00015 PAGES
RECORD PAGE DESCRIPTION
00001 00001
00005 00002 Sail Tester
00006 00003 Item Consistency Check
00007 00004 Allocator Test, Comment in Funny Places Test.
00008 00005 Forward Procedure Checks
00010 00006 Binary Operation Tests
00012 00007 Start_Code Opcode Test
00013 00008 Inchwl Test.
00015 00009 String-Creation Test
00020 00010 Constant Procedures Test
00022 00011 Scan Test
00026 00012 Fullword Test
00030 00013 Real String Conversion Test, Preload Test
00034 00014 Constant Boolean Expression Test
00036 00015 Random Simple Things Tests.
00038 ENDMK
⊗;
COMMENT Sail Tester;
BEGIN "TEST"
COMMENT This program is a comprehensive test of new features added to
SAIL since February, 1972.
The first section includes features added or modified as of 2-7-72;
DEFINE CRLF="('15&'12)";
EXTERNAL INTEGER _SKIP_;
BOOLEAN PROCEDURE WANT(STRING TEST);
BEGIN OUTSTR(TEST&"? ");
RETURN(INCHWL="Y");
END "WANT";
COMMENT Item Consistency Check
Be sure that item numbers start at the same place, with or with
declared items. First try it with ITEM IT as a declaration, then
without. IT should have the value 11. The NEW should be 11 if IT
is not declared, else 12;
COMMENT ITEM IT; REQUIRE 3 NEW_ITEMS; COMMENT IT SHOULD BE NUMBER 11;
IF WANT("ITEMVAR TEST") THEN BEGIN "ITEMVARS"
ITEMVAR X;
X←NEW; COMMENT THIS SHOULD BE NUMBER 12 -- 11 IF ITEM DECL REMOVED;
OUTSTR(CVS(CVN(X)) & CRLF);
END "ITEMVARS";
COMMENT Allocator Test, Comment in Funny Places Test.
Make sure that double-pp request and smaller-than-default
String-pp request work ok.
Also (5-12-72) make sure that Comments after declared names
don't foul up the declarations;
REQUIRE 125 SYSTEM_PDL, 300 SYSTEM_PDL, 30 STRING_PDL;
BEGIN
INTEGER IXI COMMENT IF THINGS ARE BROKEN, "COMMENT" WILL BE DEFINED;;
PROCEDURE XXX; IXI←3;
COMMENT IF THINGS ARE BROKEN, THIS COMMENT WILL BE BROKEN;
END;
COMMENT Forward Procedure Checks
This test made entirely at compile time. The following procedures have
errors:
P2 -- FORWARD has too few formals
P3 -- FORWARD has too many formals
P4 -- FORWARD has too few formals
P5 -- FORWARD has too many formals
P6 -- FORWARD and actual have different names, but types match, OK.
P7 -- Type mismatch
P8 -- No FORWARD, no error -- all OK
Enable this test by Truifying the IFC;
IFC FALSE THENC
BEGIN "FORWARDS"
FORWARD PROCEDURE P1;
PROCEDURE P1;;
FORWARD PROCEDURE P2;
PROCEDURE P2(INTEGER X);;
FORWARD PROCEDURE P3(INTEGER X);
PROCEDURE P3;;
FORWARD PROCEDURE P4(INTEGER X);
PROCEDURE P4(INTEGER X,Y);;
FORWARD PROCEDURE P5(INTEGER X,Y);
PROCEDURE P5(INTEGER X);;
FORWARD PROCEDURE P6(INTEGER X);
PROCEDURE P6(INTEGER Z);;
FORWARD PROCEDURE P7(INTEGER X);
PROCEDURE P7(REAL X);;
PROCEDURE P8(INTEGER X;STRING Y);;
END "FORWARDS";
ENDC
COMMENT Binary Operation Tests
This test was designed specifically to test binary operations which
have two STTEMPs as operands. However, it is mildly useful
to check other binary operations as well. Just watch the
flashing lights.
;
IF WANT("BINARY TEST") THEN BEGIN "BINARY OPS"
DEFINE BTEST(OP,RES)="
IF (OP)≠RES THEN OUTSTR(""BINARY OPERATION `OP' YIELDS ""&
CVS(I)&"", SHOULD BE RES""&CRLF)";
INTEGER I,J; STRING S,T;
J←5;
BTEST(I←2-3,-1);
BTEST(I←J-3,2);
BTEST(I←I-3,-1);
I←2;
BTEST(I←I↑J,32);
S←"EFG"; T←"ABCD";
BTEST(I←S-T,4);
S←3&4&5&6&7; I←2;
T←7&6&5&4&3;
BTEST(I←I↑S,8);
BTEST(I←S[3 FOR 1]+I,13);
BTEST(I←S[3 FOR 1]↑T[4 FOR 1],625);
BTEST(I←IF I>J THEN 3 ELSE 4,3);
BTEST(I←IF S[3 FOR 1]>T[4 FOR 1] THEN 3 ELSE 4,3);
END "BINARY OPS";
COMMENT Start_Code Opcode Test
All opcodes are now available in START_CODE.
CALL is the first opcode, and has the value 40.
INTUUO is the last, with value 723.
MOVE is in the middle, with value 200.
Correct compilation of these instructions does not guarantee
correctness of all opcodes, but it does eliminate systematic error.
This code will not be executed -- just examine it;
IF FALSE THEN START_CODE "OPCODES"
CALL 1,1; COMMENT TEST FIRST OPCODE;
INTUUO 1,1; COMMENT TEST LAST OPCODE;
MOVE 1,1; COMMENT TEST SOMETHING IN THE MIDDLE;
END "OPCODES";
COMMENT Inchwl Test.
INCHWL now stops on ANY activation character, returning that
character in _SKIP_, not in the string. It sucks up
the LF after a CR, returning the CR.
This test will tell you if it doesn't like you;
IF WANT("INCHWL TEST") THEN BEGIN "INCHWL"
STRING S;
OUTSTR("TYPE ""THIS IS A LINE"", TERMINATE WITH <CR>"&CRLF);
IF ¬EQU("THIS IS A LINE",S←INCHWL)
THEN OUTSTR("STRING RESULT WRONG"&CRLF);
IF _SKIP_≠'15 THEN OUTSTR("BREAK CHAR WRONG"&CRLF);
OUTSTR("TYPE ""THIS IS A LINE"", TERMINATE WITH <LF>"&CRLF);
IF ¬EQU("THIS IS A LINE",S←INCHWL)
THEN OUTSTR("STRING RESULT WRONG"&CRLF);
IF _SKIP_≠'12 THEN OUTSTR("BREAK CHAR WRONG"&CRLF);
OUTSTR("TYPE ""THIS IS A LINE"", TERMINATE WITH <ALT>"&CRLF);
IF ¬EQU("THIS IS A LINE",S←INCHWL)
THEN OUTSTR("STRING RESULT WRONG"&CRLF);
IF _SKIP_≠'175 THEN OUTSTR("BREAK CHAR WRONG"&CRLF);
OUTSTR("TYPE ""THIS IS A LINE"", TERMINATE WITH <CTRL-D>"&CRLF);
IF ¬EQU("THIS IS A LINE",S←INCHWL)
THEN OUTSTR("STRING RESULT WRONG"&CRLF);
IF _SKIP_≠'304 THEN OUTSTR("BREAK CHAR WRONG"&CRLF)
END "INCHWL";
COMMENT String-Creation Test
This just runs CAT and friends through their paces. It was designed
to test the new optimized CAT, CATCHR, CHRCAT, CHRCHR, and to
make sure that the removal of TOPSTR didn't blow the other
string-making routines. Sometimes help is requested from the TTY.
A new test (5-12-72) assures that if SGLIGN(USER) is on, strings are
aligned on full-word boundaries after concatenation, even if
optimization must be removed. ;
IF WANT("STRING TEST") THEN BEGIN "STRING CREATION"
INTEGER I,J; STRING S,T; EXTERNAL INTEGER SGLIGN;
BOOLEAN PROCEDURE UNALIGNED(REFERENCE STRING S);
BEGIN INTEGER I;
START_CODE MOVE 1,S; LSH 1,-30; MOVEM 1,I END;
RETURN(IF 1≠I≠'44 THEN TRUE ELSE FALSE);
END "UNALIGNED";
S←NULL;
T←"ABC";
IF ¬EQU(S←T&"CDE","ABCCDE") THEN
OUTSTR("CAT WITH TWO COPIES DOESN'T WORK");
IF ¬EQU(S&"CDE"&CVS(32456),"ABCCDECDE32456") THEN
OUTSTR("CAT WITH ONE COPY, OR WITH NO COPY DOESN'T WORK"&CRLF);
I←"G";
IF ¬EQU(T&I,"ABCG") THEN OUTSTR("CATCHR DOESN'T WORK"&CRLF);
IF ¬EQU(I&T,"GABC") THEN OUTSTR("CHRCAT DOESN'T WORK"&CRLF);
IF ¬EQU(I&I,"GG") THEN OUTSTR("CHRCHR DOESN'T WORK"&CRLF);
FOR J←1 STEP 1 UNTIL 20 DO BEGIN
T←S;
S←NULL;
FOR I←1 STEP 1 UNTIL 200 DO S←S&" "&CVS(I); COMMENT JUST APPEND;
END;
IF ¬EQU(S,T) THEN OUTSTR("STRNGC MESSED UP CAT"&CRLF);
USERCON(SGLIGN,I←-1,1);
S←"ABCDE"; S←S&"FGHIJ"; T←S[3 FOR 8];
T←T&CVS(25);
BEGIN "SGLIGN TEST" I←0 END;
IF UNALIGNED(S) THEN OUTSTR("SGLIGN DIDN'T WORK AT ALL"&CRLF);
IF UNALIGNED(T) THEN
OUTSTR("SGLIGN DIDN'T WORK IF ALREADY CATTED"&CRLF);
S←"ABCDE"; S←S&"FGHIJ"; T←S[3 FOR 8]; T←T&"ABCDE";
IF UNALIGNED(T) THEN
OUTSTR("SGLIGN DIDN'T WORK IF ARG1 ON TOP"&CRLF);
USERCON(SGLIGN,I←0,1);
SETBREAK(1,"ABCDE",NULL,"I");
S←"THIS IS A LINE";
T←SCAN(S,1,I);
IF ¬EQU(T,"THIS IS ")∨¬EQU(S," LINE") THEN
OUTSTR("SCAN DOESN'T WORK"&CRLF);
IF INTSCAN(S←"12345ABCDE",J)≠12345 THEN
OUTSTR("INTSCAN DOESN'T WORK"&CRLF);
IF ¬(1.1@-4≤REALSCAN(S←"1.23@-4ABCDE",J)≤1.3@-4) THEN
OUTSTR("REALSCAN DOESN'T WORK"&CRLF);
IF ¬EQU(CVSTR(CVASC("ABCDE")),"ABCDE") THEN
OUTSTR("CVSTR OR CVASC DOESN'T WORK"&CRLF);
IF ¬EQU(CVXSTR(CVSIX("ABCDEF")),"ABCDEF") THEN
OUTSTR("CVXSTR OR CVSIX DOESN'T WORK"&CRLF);
OPEN(1,"TTY",0,2,0,100,I,I);
OUTSTR("TYPE ""THIS IS A LINE""<CRLF>"&CRLF);
SETBREAK(1,10,13,"I");
S←INPUT(1,1);
IF ¬EQU("THIS IS A LINE",S)∨I≠'12 THEN
OUTSTR("INPUT DOESN'T WORK"&CRLF);
OUTSTR("TYPE ""12345 1.23@-4""<CRLF>"&CRLF);
IF INTIN(1)≠12345 THEN
OUTSTR("INTIN DOESN'T WORK"&CRLF);
IF ¬(1.1@-4≤REALIN(1)≤1.3@-4) THEN
OUTSTR("REALIN DOESN'T WORK"&CRLF);
RELEASE(1);
END "STRING CREATION";
COMMENT Constant Procedures Test
This test assures that CAT, SUBSTR, CVS, CVOS, ... CVD, CVO, EQU
will happen correctly at compile time. Part of it assures that
procedures with wrong numbers of arguments will not be evaluated.;
IF WANT("CONSTANT PROCEDURES TEST") THEN BEGIN "CONST PROC"
INTEGER I; STRING ST;
IFC ¬EQU("ABC"&"DEF","ABCDEF") THENC
OUTSTR("CONSTANT CAT DOESN'T WORK"&CRLF); ENDC
IFC ¬EQU("ABC"&CRLF,"ABC
") THENC OUTSTR("CONSTANT CAT DOESN'T WORK"&CRLF); ENDC
IFC ¬EQU(("ABCDE")[2 TO 4],"BCD") THENC
OUTSTR("CONSTANT SUBSTR DOESN'T WORK"&CRLF); ENDC
SETFORMAT(0,0);
IF ¬EQU(CVS(25),"25") THEN OUTSTR("CONSTANT CVS DOESN'T WORK"&CRLF);
SETFORMAT(10,5);
IFC TRUE THENC
BEGIN "CVG TEST" I←0 END;
IF ¬EQU(CVG(-3.5),"-3.5000 ") THEN
OUTSTR("CONSTANT CVG DOESN'T WORK"&CRLF);
ENDC
IFC CVD("12345")≠12345 THENC
OUTSTR("CONSTANT CVD DOESN'T WORK"&CRLF); ENDC
IFC FALSE THENC COMMENT WE'LL DO OUR BEST, BUT ... ;
I←EQU("ABC");
I←EQU("ABC","CDE","EFG");
I←CVD;
I←CVD("ABC","DEF");
ST←CVS;
ST←CVS(2,3,4);
ENDC
END "CONST PROC";
COMMENT Scan Test
This was designed to test SCAN in all its many guises.
It will tell you what it doesn't like;
IF WANT("SCAN TEST") THEN BEGIN "SCAN TEST"
PROCEDURE OUTSTR(STRING S);
BEGIN "OUTSTR"
EXTERNAL PROCEDURE OUTSTR(STRING S);
OUTSTR(S&CRLF)
END "OUTSTR";
STRING S,T; INTEGER I;
SETBREAK(1,"ABCD",NULL,"I");
SETBREAK(2,"ABCD"," ","I");
SETBREAK(3,"ABCD",NULL,"IA");
SETBREAK(4,"ABCD",NULL,"IR");
S←NULL;
IF ¬EQU(T←SCAN(S,1,I),NULL)∨¬EQU(S,NULL)∨I≠0 THEN
OUTSTR("SCAN 1 DOESN'T WORK");
S←"A LINE IS THIS";
IF ¬EQU(T←SCAN(S,1,I),NULL)∨¬EQU(S," LINE IS THIS")∨I≠"A"
THEN OUTSTR("SCAN 2 DOESN'T WORK");
S←"THIS IS A LINE";
IF ¬EQU(T←SCAN(S,1,I),"THIS IS ") ∨¬EQU(S," LINE")∨I≠"A"
THEN OUTSTR("SCAN 3 DOESN'T WORK");
S←"THIS LINE IS A";
IF ¬EQU(T←SCAN(S,1,I),"THIS LINE IS ")∨¬EQU(S,NULL)∨I≠"A"
THEN OUTSTR("SCAN 4 DOESN'T WORK");
S←"THIS IS LINE";
IF ¬EQU(T←SCAN(S,1,I),"THIS IS LINE")∨¬EQU(S,NULL)∨I≠0
THEN OUTSTR("SCAN 5 DOESN'T WORK");
S←"A LINE IS THIS";
IF ¬EQU(T←SCAN(S,2,I),NULL)∨¬EQU(S," LINE IS THIS")∨I≠"A"
THEN OUTSTR("SCAN 6 DOESN'T WORK");
S←"THIS IS A LINE";
IF ¬EQU(T←SCAN(S,2,I),"THISIS") ∨¬EQU(S," LINE")∨I≠"A"
THEN OUTSTR("SCAN 7 DOESN'T WORK");
S←"THIS LINE IS A";
IF ¬EQU(T←SCAN(S,2,I),"THISLINEIS")∨¬EQU(S,NULL)∨I≠"A"
THEN OUTSTR("SCAN 8 DOESN'T WORK");
S←"THIS IS LINE";
IF ¬EQU(T←SCAN(S,2,I),"THISISLINE")∨¬EQU(S,NULL)∨I≠0
THEN OUTSTR("SCAN 9 DOESN'T WORK");
S←"A LINE IS THIS";
IF ¬EQU(T←SCAN(S,3,I),"A")∨¬EQU(S," LINE IS THIS")∨I≠"A"
THEN OUTSTR("SCAN 10 DOESN'T WORK");
S←"THIS IS A LINE";
IF ¬EQU(T←SCAN(S,3,I),"THIS IS A") ∨¬EQU(S," LINE")∨I≠"A"
THEN OUTSTR("SCAN 11 DOESN'T WORK");
S←"THIS LINE IS A";
IF ¬EQU(T←SCAN(S,3,I),"THIS LINE IS A")∨¬EQU(S,NULL)∨I≠"A"
THEN OUTSTR("SCAN 12 DOESN'T WORK");
S←"THIS IS LINE";
IF ¬EQU(T←SCAN(S,3,I),"THIS IS LINE")∨¬EQU(S,NULL)∨I≠0
THEN OUTSTR("SCAN 13 DOESN'T WORK");
S←"A LINE IS THIS";
IF ¬EQU(T←SCAN(S,4,I),NULL)∨¬EQU(S,"A LINE IS THIS")∨I≠"A"
THEN OUTSTR("SCAN 14 DOESN'T WORK");
S←"THIS IS A LINE";
IF ¬EQU(T←SCAN(S,4,I),"THIS IS ") ∨¬EQU(S,"A LINE")∨I≠"A"
THEN OUTSTR("SCAN 15 DOESN'T WORK");
S←"THIS LINE IS A";
IF ¬EQU(T←SCAN(S,4,I),"THIS LINE IS ")∨¬EQU(S,"A")∨I≠"A"
THEN OUTSTR("SCAN 16 DOESN'T WORK");
S←"THIS IS LINE";
IF ¬EQU(T←SCAN(S,4,I),"THIS IS LINE")∨¬EQU(S,NULL)∨I≠0
THEN OUTSTR("SCAN 17 DOESN'T WORK");
END "SCAN TEST";
COMMENT Fullword Test
This tests WORDIN, WORDOUT, ARRYIN, ARROUT in many ways. It
complains if it doesn't like you;
IF WANT("FULLWORD IO TEST") THEN BEGIN "FULLWORD TRANSFERS"
INTEGER EOF,I,J;
INTEGER ARRAY X[0:383];
PROCEDURE CHECKB(INTEGER FLAG);
BEGIN "CHECKB"
INTEGER L,H;
I←POINT(36,X[0],35);
IF FLAG THEN L←LDB(I-1) ELSE IF
L≠LDB(I-1) THEN OUTSTR("LOWER BOUND CLOBBERED IN FULLWORD"&CRLF);
IF FLAG THEN H←LDB(I+384) ELSE IF
H≠LDB(I+384) THEN OUTSTR("UPPER BOUND CLOBBERED IN FULLWORD"&CRLF);
END "CHECKB";
CHECKB(TRUE);
OPEN(1,"DSK",'10,0,2,0,I,EOF);
ENTER(1,"TEST.DAT",I);
FOR I←0 STEP 1 UNTIL 383 DO X[I]←I;
BEGIN "WR FILE" END "WR FILE";
ARRYOUT(1,X[0],128); "ONE RECORD"
ARRYOUT(1,X[I←128],29); "WITHIN A RECORD"
ARRYOUT(1,X[I←I+29],113); "ACROSS A RECORD BOUNDARY"
WORDOUT(1,X[I←I+113]); "A SINGLE WORD"
ARRYOUT(1,X[I←I+1],113); "LAST GROUP, 3 RECORDS TOTAL"
RELEASE(1);
CHECKB(FALSE); "MAKE SURE NOTHING HAS MOVED"
X[0]←-1; ARRBLT(X[1],X[0],383);
OPEN(1,"DSK",'10,2,0,0,I,EOF);
LOOKUP(1,"TEST.DAT",I);
BEGIN "RD FILE" END "RD FILE";
ARRYIN(1,X[0],113); "READ WITHIN RECORD"
X[I←113]←WORDIN(1); "ONE WORD, SAME RECORD"
ARRYIN(1,X[I←I+1],28); "ACROSS BOUNDARY"
ARRYIN(1,X[I←I+28],114); "FINISH UP THE RECORD"
ARRYIN(1,X[I←I+114],129); "READ ONE PAST EOF"
BEGIN "EOF CHK" END "EOF CHK";
IF ¬EOF THEN OUTSTR("EOF DOESN'T WORK IN WORDIN"&CRLF) ELSE
IF EOF≠('20010 LSH 18)+128 THEN OUTSTR("EOF WITH BAD VALUE"&CRLF);
RELEASE(1);
CHECKB(FALSE);
FOR I←0 STEP 1 UNTIL 383 DO IF X[I]≠I THEN
OUTSTR("WORD "&CVS(I)&" HAS VALUE "&CVS(X[I])&CRLF);
OPEN(1,"DSK",'17,0,0,0,I,EOF);
ENTER(1,"TEST.DAT",I);
FOR I←1 STEP 1 UNTIL 10 DO WORDOUT(1,I);
RELEASE(1);
OPEN(1,"DSK",'17,0,0,0,I,I);
LOOKUP(1,"TEST.DAT",I);
BEGIN "DMP RD TEST" END "DMP RD TEST";
FOR J←1 STEP 1 UNTIL 10 DO IF (I←WORDIN(1))≠J THEN
OUTSTR("DUMP MODE: WORD "&CVS(J)&" HAS VALUE "&CVS(I)&CRLF);
RELEASE(1)
END "FULLWORD TRANSFERS";
COMMENT Real String Conversion Test, Preload Test
This tests CVE, CVF, CVG. I test so much because once I modified
the spacing algorithm, and now that I put it back I don't
trust it;
IF WANT("REALSTRING TEST") THEN BEGIN "REALSTRING CONVERSIONS"
STRING S,COD; REAL X;INTEGER I;
SETFORMAT(0,0);
X←3.5;
IF ¬EQU(CVE(X)," @0 ") THEN OUTSTR("CVE 1 IS WRONG"&CRLF);
IF ¬EQU(CVF(X)," 4.") THEN OUTSTR("CVF 2 IS WRONG"&CRLF);
IF ¬EQU(CVG(X)," @0 ") THEN OUTSTR("CVG 3 IS WRONG"&CRLF);
SETFORMAT(10,5);
IF ¬EQU(CVE(X)," .35000@1 ") THEN OUTSTR("CVE 4 IS WRONG"&CRLF);
IF ¬EQU(CVF(X)," 3.50000") THEN OUTSTR("CVF 5 IS WRONG"&CRLF);
IF ¬EQU(CVG(X)," 3.5000 ") THEN OUTSTR("CVG 6 IS WRONG"&CRLF);
SETFORMAT(-1,0);
IF ¬EQU(CVE(X)," @0 ") THEN OUTSTR("CVE 7 IS WRONG"&CRLF);
IF ¬EQU(CVF(X)," 4.") THEN OUTSTR("CVF 8 IS WRONG"&CRLF);
IF ¬EQU(CVG(X)," @0 ") THEN OUTSTR("CVG 9 IS WRONG"&CRLF);
SETFORMAT(-10,5);
IF ¬EQU(CVE(X)," .35000@1 ") THEN OUTSTR("CVE 10 IS WRONG"&CRLF);
IF ¬EQU(CVF(X)," 003.50000") THEN OUTSTR("CVF 11 IS WRONG"&CRLF);
IF ¬EQU(CVG(X)," 3.5000 ") THEN OUTSTR("CVG 12 IS WRONG"&CRLF);
X←-3.5;SETFORMAT(0,0);
IF ¬EQU(CVE(X),"- @0 ") THEN OUTSTR("CVE 13 IS WRONG"&CRLF);
IF ¬EQU(CVF(X),"-4.") THEN OUTSTR("CVF 14 IS WRONG"&CRLF);
IF ¬EQU(CVG(X),"- @0 ") THEN OUTSTR("CVG 15 IS WRONG"&CRLF);
SETFORMAT(10,5);
IF ¬EQU(CVE(X),"-.35000@1 ") THEN OUTSTR("CVE 16 IS WRONG"&CRLF);
IF ¬EQU(CVF(X)," -3.50000") THEN OUTSTR("CVF 17 IS WRONG"&CRLF);
IF ¬EQU(CVG(X),"-3.5000 ") THEN OUTSTR("CVG 18 IS WRONG"&CRLF);
SETFORMAT(-1,0);
IF ¬EQU(CVE(X),"- @0 ") THEN OUTSTR("CVE 19 IS WRONG"&CRLF);
IF ¬EQU(CVF(X),"-4.") THEN OUTSTR("CVF 20 IS WRONG"&CRLF);
IF ¬EQU(CVG(X),"- @0 ") THEN OUTSTR("CVG 21 IS WRONG"&CRLF);
SETFORMAT(-10,5);
IF ¬EQU(CVE(X),"-.35000@1 ") THEN OUTSTR("CVE 22 IS WRONG"&CRLF);
IF ¬EQU(CVF(X),"-003.50000") THEN OUTSTR("CVF 23 IS WRONG"&CRLF);
IF ¬EQU(CVG(X),"-3.5000 ") THEN OUTSTR("CVG 24 IS WRONG"&CRLF);
END "REALSTRING CONVERSIONS";
IFC TRUE THENC
IF FALSE THEN BEGIN "PRELOAD WARNINGS"
DEFINE PRELOAD_WITH="COMMENT";
INTEGER N;
PRELOAD_WITH 0,0,0,0,0;
INTEGER ARRAY FOO[1:N];
PRELOAD_WITH 1,2,3,45;
EXTERNAL INTEGER ARRAY BAZ[1:N];
FOO[1]←3
END "PRELOAD WARNINGS";
ENDC
COMMENT Constant Boolean Expression Test
Enable and look at the code if you suspect something;
IFC FALSE THENC
BEGIN "BOOL"
INTEGER A,B;
IF A THEN B←3;
IF 3 THEN B←3;
IF A<B THEN B←3;
IF A<3 THEN B←3;
IF 3<A THEN B←3;
IF 3<5 THEN B←3;
IF 3>5 THEN B←3;
IF A∧B THEN B←3;
IF A∧(3<5) THEN B←3;
IF A∧(5<3) THEN B←3;
IF 5<3∧A THEN B←3;
IF A∧3 THEN B←3;
IF 3<5∧4<7 THEN B←3;
IF 3<5∧4>7 THEN B←3;
IF 3>5∧4<7 THEN B←3;
IF 3>5∧4>7 THEN B←3;
IF A∨B THEN B←3;
IF A∨(3<5) THEN B←3;
IF A∨(5<3) THEN B←3;
IF 5<3∨A THEN B←3;
IF A∨3 THEN B←3;
IF 3<5∨4<7 THEN B←3;
IF 3<5∨4>7 THEN B←3;
IF 3>5∨4<7 THEN B←3;
IF 3>5∨4>7 THEN B←3;
A←3<5∧(4>7∨2<3);
A←IF 3<5∧(4>7∨2<3) THEN 2 ELSE 3;
A←3<5∧(4>7∨2>3);
A←IF 3<5∧(4>7∨2>3) THEN 2 ELSE 3;
END "BOOL"
ENDC
COMMENT Random Simple Things Tests.
These should take very little time, and should always work.
It's just a way to assure that trivial bugs don't creep back in;
BEGIN "RANDOM"
STRING SS;
INTEGER I,J, K;
Comment be sure that NEGAT bug in Loop code is gone;
SS←"ABCDE";
J←1; K←0;
FOR I←1 STEP 1 UNTIL 10-LENGTH(SS) DO K←-1;
IF I≠6∨¬K THEN OUTSTR("NEGAT BUG IN FOR CODE IS BACK"&CRLF);
J←1; K←0;
FOR I←1 STEP J UNTIL 10-LENGTH(SS) DO K←-1;
IF I≠6∨¬K THEN OUTSTR("NEGAT BUG IN FOR CODE IS BACK"&CRLF);
Comment type the version number. Load this with something whose
Version numbers don't exist, are the same, are not the same;
START_CODE MOVE 1,'137; MOVEM 1,I END;
OUTSTR("VERSION IS "&CVOS(I)&CRLF);
END "RANDOM"
END "TEST";